﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BasketStats.Core.Team;
using BasketStats.Core.Stats;
using BasketStats.Core.Game;
using System.Windows.Forms.DataVisualization.Charting;

namespace BasketStats
{
    public partial class ChartTestForm : Form
    {
        private Player m_player;

        public Player Player
        {
            get
            {
                return m_player;
            }
            set
            {
                if (value != m_player)
                {
                    m_player = value;
                    Refresh();
                }
            }
        }

        public ChartTestForm()
        {
            InitializeComponent();
        }

        public override void Refresh()
        {
            if (m_player != null)
            {
                chart1.Titles.Add(string.Format("Shot stats - {0} {1}", m_player.Info.Name, m_player.Info.FamilyName));
                chart1.Legends.Add(new Legend());

                var ftSerie = chart1.Series.Add("FT");
                ftSerie.LegendText = "FT";
                ftSerie.IsValueShownAsLabel = true;
                ftSerie.LabelFormat = "P2";
                ftSerie.Points.Add(0.2342);
                ftSerie.Points.Add(0.523);
                ftSerie.Points.Add(0.4222);

                var fgSerie = chart1.Series.Add("FG");
                fgSerie.LegendText = "FG";
                fgSerie.IsValueShownAsLabel = true;
                fgSerie.Points.Add(0.34).AxisLabel = "First";
                fgSerie.Points.Add(0.12).AxisLabel = "Second";
                fgSerie.Points.Add(0.68).AxisLabel = "Third";

                var tptSerie = chart1.Series.Add("3PT");
                tptSerie.LegendText = "3PT";
                tptSerie.IsValueShownAsLabel = true;
                tptSerie.Points.Add(0.3);
                tptSerie.Points.Add(0.67);
                tptSerie.Points.Add(0.59);

                //var totalSerie = chart1.Series.Add("Total");
                //totalSerie.LegendText = "Total";
                //totalSerie.Label = "Total";
            }
            base.Refresh();
        }
    }
}
